'''
Created on 1. tra. 2011.

@author: Ana Banana
'''

from Bio import pairwise2
import sys

f = open('test_output.txt', 'w');

from Bio import SubsMat;
from Bio.SubsMat import MatrixInfo

bl30_dict = {};

bl30 = SubsMat.SeqMat(MatrixInfo.blosum90);
#print bl30.viewitems()
#print type(bl30.viewitems())
for (key,value) in bl30.viewitems() :
    bl30_dict[key] = value;

g1 = 'MVLLKEYRVILPVSVDEYQVGQLYSVAEASKNETGGGEGVEVLVNEPYEKDGEKGQYTHK\
IYHLQSKVPTFVRMLAPEGALNIHEKAWNAYPYCRTVITNEYMKEDFLIKIETWHKPDLG\
TQENVHKLEPEAWKHVEAVYIDIADRSQVLSKDYKAEEDPAKFKSIKTGRGPLGPNWKQE\
LVNQKDCPYMCAYKLVTVKFKWWGLQNKVENFIHKQERRLFTNFHRQLFCWLDKWVDLTM\
DDIRRMEEETKRQLDEMRQKDPVKGMTADD'
g2 = 'MVLLKEYRVILPVSVDEYQVGQLYSVAEASKNETGGGEGVEVLVNEPYEKDDGEKGQYTH\
KIYHLQSKVPTFVRMLAPEGALNIHEKAWNAYPYCRTVITNEYMKEDFLIKIETWHKPDL\
GTQENVHKLEPEAWKHVEAIYIDIADRSQVLSKDYKAEEDPAKFKSIKTGRGPLGPNWKQ\
ELVNQKDCPYMCAYKLVTVKFKWWGLQNKVENFIHKQEKRLFTNFHRQLFCWLDKWVDLT\
MDDIRRMEEETKRQLDEMRQKDPVKGMTADD'
alignments_G = pairwise2.align.globaldx(g1,g2,bl30_dict);

#for i in (len(bl30.viewitems()))


for al in alignments_G:
    print type(al); print '\n';
    for el in al:
        f.write(str(el)); f.write(' ');
    f.write("\n)");
f.close();

if len(sys.argv) == 1:
    print "haha";
    exit(-1);